﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Wjtour.Common;
using Hjp.FrameWork.Common;
using System.Xml;
using System.Linq;

namespace Wjtour.Web.Front
{
    public partial class travelmap : BasePage
    {
        private BLL.scene_bll _scene_bll = new BLL.scene_bll();
        private List<Domain.scene> sceneList = new List<Domain.scene>();

        protected void Page_Load(object sender, EventArgs e)
        {
            XmlDocument doc = new XmlDocument();
            XmlElement root = doc.CreateElement("root");
            sceneList = _scene_bll.GetAll<Domain.scene>("select * from scene").ToList();
            foreach (var item in sceneList)
            {
                XmlElement el = doc.CreateElement("btn");
                el.SetAttribute("btnName", item.scenename);
                el.SetAttribute("links", string.Format("/scenicdetail.aspx?id={0}&tab=0|/scenicdetail.aspx?id={0}&tab=1|/scenicdetail.aspx?id={0}&tab=2|/scenicdetail.aspx?id={0}&tab=3", item.id));
                root.AppendChild(el);
            }
            doc.AppendChild(root);

            string path = Server.MapPath("css/images/btnLinks.xml");
            doc.Save(path);
        }
    }
}
